import type { postOrPutType } from "@/constants";
import type { IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.ts";
/* 获取 广告信息 地址*/
const url = "/back/banner";
/* 获取 广告信息 */
export const getBannerInfo = <T, D>(params?: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 新增，修改广告信息 */
export const commonBannerInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 修改广告信息 排序 信息 */
export const putBannerSortInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-sort", params, "PUT");
};
/* 删除 广告信息 */
export const deleteBannerInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
